﻿###########################################################################
#
#执行方式:(采用CMake外部编译的方式执行)
#1:首先在这个CMakeLists.txt文件所在的目录下面创建一个临时目录,如创建tmp目录
#2:在Shell命令行下面cd到刚才创建的临时目录中去
#3:执行cmake ../../../, 注意相对路径,要求相对路径指到mtp2.0那个目录
#
###########################################################################

add_depends("busdriver" "proto" "protobuf" "muchinfolog" "muchinfodb" "xerces" "sqlapi" "exception" "log4cplus" "boost" "loki" "monitoragent" "libdl")

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_LIST_DIR}/src)

INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/service/include/)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/service/include/interface)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_LIST_DIR}/src DIR_SRC)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_LIST_DIR}/src/common DIR_SRC)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_LIST_DIR}/src/message DIR_SRC)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_LIST_DIR}/src/cache DIR_SRC)

AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_LIST_DIR}/src DIR_SRC)
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_LIST_DIR}/src/common DIR_SRC)
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_LIST_DIR}/src/message DIR_SRC)
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_LIST_DIR}/src/cache DIR_SRC)

set(local_file follow)

set(abs_local_file ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}${local_file}${CMAKE_SHARED_LIBRARY_SUFFIX})

set(local_dist_path ${CMAKE_CURRENT_LIST_DIR}/bin/)

make_directory(${local_dist_path})

ADD_LIBRARY(${local_file} SHARED ${DIR_SRC})

target_link_libraries(${local_file} ${curr_project_library_list})

add_custom_command(TARGET ${local_file} POST_BUILD COMMAND ${CMAKE_COMMAND} -E 
    copy ${abs_local_file} ${local_dist_path})
